package com.fay.corejava.chapter4;

/**
 * @Title:
 * @Description:
 * @Author Fay Wang
 * @Date 2022/2/20 23:05
 * @Version 1.0
 */
public enum Operation1 {

    ADD,SUBTRACT,MULTIPLY,DIVIDE;

    public static int eval(Operation1 op, int arg1, int arg2) {
        int res = 0;
        switch (op) {
            case ADD:
                res = arg1 + arg2;
                break;
            case SUBTRACT:
                res = arg1 - arg2;
                break;
            case MULTIPLY:
                res = arg1 * arg2;
                break;
            case DIVIDE:
                res = arg1 / arg2;
                break;
        }

        return res;
    }
}
